function model = train_svm(tr_data, tr_label, te_data, te_label, kernel_param, C_param, gamma_param, coef0_param, dergree_param)

    % Creates the string needed for training the svm
    if kernel_param==0
        option_str = sprintf('-t %d', kernel_param);
    elseif kernel_param==1
        option_str = sprintf('-t %d -c %d -g %f -r %f -d %d', kernel_param, C_param, gamma_param, coef0_param, dergree_param);
    % (kernel_param==2)
    elseif kernel_param==2
        option_str = sprintf('-t %d -c %d -g %f', kernel_param, C_param, gamma_param);
    end
          
    % Train the model
    model = svmtrain(tr_label, tr_data, option_str);
end

